/* GUI CONVERTED from ecapsmta.p (converter v1.76) Tue Dec 31 10:44:59 2002 */
/* ecapsmta.p - PCO/PCR SUBMIT subroutine                               */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/* $Revision: 1.6.1.6 $                                                     */
/*V8:ConvertMode=Maintenance                                            */
/* REVISION: 7.4      LAST EDIT: 04/11/95   MODIFIED BY: ame *H0CF*     */
/* REVISION: 8.6      LAST EDIT: 06/06/96   MODIFIED BY: Mariya Kutwal *K00C* */
/*K00C** Change all references to ect_mstr to pct_mstr
 *       Change all references to qad_wkfl where qad_key1 = "ECN-CTRL"
 *          to pcc_ctrl
 *       Change all references to eca_mstr the rst_mstr and rstd_det
 *K00C*/
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.0      LAST MODIFIED: 12/06/99   BY: *K24J* Jyoti Thatte       */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/14/00   BY: *N0KW* Jacolyn Neder      */
/* Old ECO marker removed, but no ECO header exists *F0PN*                    */
/* $Revision: 1.6.1.6 $    BY: Katie Hilbert        DATE: 12/27/02  ECO: *P0L8*   */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/

{mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

define input parameter ecm_recid as recid.
define input-output parameter ecmtype2 like ecm_type no-undo.
define input-output parameter ecmassign2 like ecm_assign.
define input-output parameter  yn like mfc_logical.

define shared variable local_type like ecm_type.
define shared variable global_recid as recid.

define shared frame d.

FORM /*GUI*/ 
   ecmtype2         column-label "PCC Type"
   ecmassign2       column-label "Dsgn Group"
   pct_doc_type     no-label
with frame d width 29 title
   color normal (getFrameTitle("DOCUMENT_FOR_RE-PROCESS",33))
   row 5 centered overlay attr-space THREE-D /*GUI*/.


/* SET EXTERNAL LABELS */
setFrameLabels(frame d:handle).

find ecm_mstr where recid(ecm_mstr) = ecm_recid no-error.

global_recid = ?.
update
   ecmtype2
   ecmassign2
with frame d
editing:
   local_type = input ecmtype2.
   if frame-field = "ecmtype2" then do:
      /* FIND NEXT/PREVIOUS RECORD */
      {mfnp.i pct_mstr ecmtype2 pct_type ecmtype2 pct_type pct_type}
      if global_recid <> ? then do:
         recno = global_recid.
         find pct_mstr
            where recid(pct_mstr) = recno
         no-lock no-error.
         global_recid = ?.
      end.

      if recno <> ? then
         display
            pct_type     @ ecmtype2
            pct_dsgn_grp @ ecmassign2
            pct_doc_type
         with frame d.

   end.
   else do:
      readkey.
      apply lastkey.
   end.
end.

if not can-find (first pct_mstr where pct_type = ecmtype2)
then do:
   /* Type/Design group does not exist */
   {pxmsg.i &MSGNUM=5604 &ERRORLEVEL=3}
   next-prompt ecmtype2 with frame d.
   undo, retry.
end.

if not can-find (pct_mstr where pct_type = ecmtype2 and
                            pct_dsgn_grp = ecmassign2)
then do:
   /* Type/Design group does not exist */
   {pxmsg.i &MSGNUM=5604 &ERRORLEVEL=3}
   next-prompt ecmassign2 with frame d.
   undo, retry.
end.

find pct_mstr
   where pct_type = ecmtype2 and
         pct_dsgn_grp = ecmassign2
no-lock no-error.
display
   pct_doc_type
with frame d.

if pct_doc_type <> ecm_doc_type then do:
   /* PCO/PCR TYPE DOES NOT MATCH TARGET PCO/PCR REQUIREMENT */
   {pxmsg.i &MSGNUM=2176 &ERRORLEVEL=2}
   hide message.
end.

yn = no.
if ecmtype2 <> ecm_type or ecmassign2 <> ecm_assign
then do:
   /* PCO type and design group modified.  Continue? */
   {pxmsg.i &MSGNUM=2166 &ERRORLEVEL=1 &CONFIRM=yn}
end.
else do:
   /* PCO type and design group not modified.  Continue? */
   {pxmsg.i &MSGNUM=2179 &ERRORLEVEL=1 &CONFIRM=yn}
end.
